<?php

namespace Contacts\Model;

use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;


class Contacts implements InputFilterAwareInterface
{
	public $id;
	public $fullname;
	public $jobtitle;
	public $mobilephone;
	
	protected $inputFilter;

	public function exchangeArray($data)
	{
		$this->id     = (isset($data['id'])) ? $data['id'] : null;
		
		$this->fullname  = (isset($data['fullname'])) ? $data['fullname'] : null;
		$this->jobtitle     = (isset($data['jobtitle'])) ? $data['jobtitle'] : null;
		$this->mobilephone  = (isset($data['mobilephone'])) ? $data['mobilephone'] : null;
	}
	
	public function getArrayCopy()
	{
		return get_object_vars($this);
	}
	
	
	public function setInputFilter(InputFilterInterface $inputFilter)
	{
		throw new \Exception("Not used");
	}
	
	public function getInputFilter()
	{
		if (!$this->inputFilter) {
			$inputFilter = new InputFilter();
			$factory     = new InputFactory();
			
			
	
			$inputFilter->add($factory ->createInput (array(
					'name'     => 'id',
					'required' => true,
					'filters'  => array(
							array('name' => 'Int'),
					),
			));
	
			$inputFilter->add($factory->createInput(array(
					'name'     => 'fullname',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					
			)));
	$inputFilter->add($factory->createInput(array(
					'name'     => 'jobtitle',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					
			)));
			
$inputFilter->add($factory->createInput(array(
					'name'     => 'mobilephone',
					'required' => true,
					'filters'  => array(
							array('name' => 'StripTags'),
							array('name' => 'StringTrim'),
					),
					
			)));
			$this->inputFilter = $inputFilter;
		}
	
		return $this->inputFilter;
	}
	
}